/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.evl.tecinfo.gui;

import br.com.evl.tecinfo.modelo.ApenasLetrasMaiusculaseMinuscula;
import br.com.evl.tecinfo.modelo.Funcionario;
import br.com.evl.tecinfo.modelo.MaiusculaseMinusculaseEspaco;
import br.com.evl.tecinfo.modelo.TudoMenosEspeciais;
import java.awt.Color;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.text.MaskFormatter;

/**
 *
 * @author D_Y
 */
public class EditarFuncionario extends javax.swing.JFrame {

    private int clicou_ok;
    private int linha_editar = -1;
    private ArrayList<Funcionario> camposFuncionarios = new ArrayList<>();
    private ArrayList<JCheckBox> areasJCheckBox = new ArrayList();
    private ArrayList<JComboBox> cargoJCombobox = new ArrayList();

    /**
     * Creates new form editar
     */
    public EditarFuncionario() {
        initComponents();
        setSize(920, 600);
        setTitle("Editar Funcionários");
        setLocationRelativeTo(this);

        //IMAGEM ÍCONE
        ImageIcon icone = new ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/icon64x64.png"));
        setIconImage(icone.getImage());

        DefaultTableModel teste1 = (DefaultTableModel) jTableEditFuncionario.getModel();
        JTable tabela = new JTable(teste1);
        teste1.addColumn(areasJCheckBox);
        teste1.addColumn(camposFuncionarios);
        
       





        //LIMITANDO CARACTERES DO FORMULÁRIO
        JTextField textFieldNome = new JTextField();
        jFormattedTextField_Nome.setDocument(new MaiusculaseMinusculaseEspaco(50));

        JTextField textFieldConta = new JTextField();
        jFormattedTextField_Conta.setDocument(new TudoMenosEspeciais(20));

        JTextField textFieldAgencia = new JTextField();
        jFormattedTextField_Agencia.setDocument(new TudoMenosEspeciais(15));

        //TRY CATCH HORA        
        MaskFormatter formatterNome = null;
        try {
            formatterNome = new MaskFormatter("##,##");

        } catch (ParseException exc) {
            exc.printStackTrace();
        }
        formatterNome.install(jFormattedTextField_Hora);
        //FIM TRY CATCH HORA ********   

        //TRY CATCH CPF
        MaskFormatter formatterCPF = null;
        try {
            formatterCPF = new MaskFormatter("###.###.###-##");
        } catch (ParseException ex) {
            Logger.getLogger(CadastroFuncionarios_CA.class.getName()).log(Level.SEVERE, null, ex);
        }
        formatterCPF.install(jFormattedTextField_CPF);
        //FIM TRY CATCH CPF ********
        areasJCheckBox.add(jCheckBox1_EI_FUNCIONARIO);
        areasJCheckBox.add(jCheckBox1_EFF1_FUNCIONARIO);
        areasJCheckBox.add(jCheckBox1_EF2_FUNCIONARIO);



        for (int i = 0; i < areasJCheckBox.size(); i++) {
            areasJCheckBox.get(i).setEnabled(false);
        }

    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabelTitulo = new javax.swing.JLabel();
        jLabelIMGListaFuncionario = new javax.swing.JLabel();
        jButtonEditar = new javax.swing.JButton();
        jButtonRemover = new javax.swing.JButton();
        jButtonSair = new javax.swing.JButton();
        jButtonSalvar = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTableEditFuncionario = new javax.swing.JTable();
        jLabel_Conta = new javax.swing.JLabel();
        jFormattedTextField_Nome = new javax.swing.JFormattedTextField();
        jFormattedTextField_CPF = new javax.swing.JFormattedTextField();
        jLabel_Area = new javax.swing.JLabel();
        jFormattedTextField_Hora = new javax.swing.JFormattedTextField();
        jLabel_CPF = new javax.swing.JLabel();
        JLabel_Cargo = new javax.swing.JLabel();
        jLabel_Hora = new javax.swing.JLabel();
        jComboBox_Pagamento = new javax.swing.JComboBox();
        jFormattedTextField_Conta = new javax.swing.JFormattedTextField();
        jFormattedTextField_Agencia = new javax.swing.JFormattedTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel_Area = new javax.swing.JPanel();
        jCheckBox1_EF2_FUNCIONARIO = new javax.swing.JCheckBox();
        jCheckBox1_EFF1_FUNCIONARIO = new javax.swing.JCheckBox();
        jCheckBox1_EI_FUNCIONARIO = new javax.swing.JCheckBox();
        jComboBox_Cargo = new javax.swing.JComboBox();
        jLabel_Agencia = new javax.swing.JLabel();
        jLabel_Nome = new javax.swing.JLabel();
        jLabel_Pagamento = new javax.swing.JLabel();
        jLabel_IMG_bgCima = new javax.swing.JLabel();
        jLabel_IMG_bgLado2 = new javax.swing.JLabel();
        jLabel_IMG_bgLado = new javax.swing.JLabel();
        jLabel_IMG_bgBaixo = new javax.swing.JLabel();
        jLabel_IMG_bg2 = new javax.swing.JLabel();
        jLabelIMGbg = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setResizable(false);
        getContentPane().setLayout(null);

        jLabelTitulo.setFont(new java.awt.Font("Century Gothic", 0, 15)); // NOI18N
        jLabelTitulo.setForeground(new java.awt.Color(102, 102, 102));
        jLabelTitulo.setText("LISTA DE FUNCIONÁRIOS");
        getContentPane().add(jLabelTitulo);
        jLabelTitulo.setBounds(370, 30, 177, 30);

        jLabelIMGListaFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/CADASTRODEUSUARIO.png"))); // NOI18N
        getContentPane().add(jLabelIMGListaFuncionario);
        jLabelIMGListaFuncionario.setBounds(360, 10, 200, 70);

        jButtonEditar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jButtonEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/editarrelatorio20x20.png"))); // NOI18N
        jButtonEditar.setText("EDITAR");
        jButtonEditar.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButtonEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEditarActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonEditar);
        jButtonEditar.setBounds(780, 100, 120, 30);

        jButtonRemover.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jButtonRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/excluirrelatorio20x20.png"))); // NOI18N
        jButtonRemover.setText("REMOVER");
        jButtonRemover.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jButtonRemover.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jButtonRemover.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonRemoverActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonRemover);
        jButtonRemover.setBounds(780, 140, 119, 30);

        jButtonSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/sair20x20.png"))); // NOI18N
        jButtonSair.setText("SAIR");
        jButtonSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSairActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonSair);
        jButtonSair.setBounds(780, 230, 120, 30);

        jButtonSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/salvar20x20.png"))); // NOI18N
        jButtonSalvar.setText("SALVAR");
        jButtonSalvar.setEnabled(false);
        jButtonSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSalvarActionPerformed(evt);
            }
        });
        getContentPane().add(jButtonSalvar);
        jButtonSalvar.setBounds(780, 180, 120, 30);

        jTableEditFuncionario.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jTableEditFuncionario.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Funcionário", "Cargo", "Área", "CPF", "Valor da Hora", "Nº da Conta", "Angência"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jTableEditFuncionario);

        getContentPane().add(jScrollPane2);
        jScrollPane2.setBounds(20, 310, 880, 240);

        jLabel_Conta.setText("Nº Conta:");
        jLabel_Conta.setEnabled(false);
        getContentPane().add(jLabel_Conta);
        jLabel_Conta.setBounds(550, 150, 60, 30);

        jFormattedTextField_Nome.setEnabled(false);
        getContentPane().add(jFormattedTextField_Nome);
        jFormattedTextField_Nome.setBounds(70, 110, 460, 30);

        jFormattedTextField_CPF.setEnabled(false);
        getContentPane().add(jFormattedTextField_CPF);
        jFormattedTextField_CPF.setBounds(70, 150, 190, 30);

        jLabel_Area.setText("Area:");
        jLabel_Area.setEnabled(false);
        getContentPane().add(jLabel_Area);
        jLabel_Area.setBounds(20, 190, 50, 30);

        jFormattedTextField_Hora.setEnabled(false);
        getContentPane().add(jFormattedTextField_Hora);
        jFormattedTextField_Hora.setBounds(320, 150, 210, 30);

        jLabel_CPF.setText("CPF:");
        jLabel_CPF.setEnabled(false);
        getContentPane().add(jLabel_CPF);
        jLabel_CPF.setBounds(20, 150, 30, 30);

        JLabel_Cargo.setText("Cargo:");
        JLabel_Cargo.setEnabled(false);
        getContentPane().add(JLabel_Cargo);
        JLabel_Cargo.setBounds(350, 190, 50, 30);

        jLabel_Hora.setText("V. Hora:");
        jLabel_Hora.setEnabled(false);
        getContentPane().add(jLabel_Hora);
        jLabel_Hora.setBounds(270, 150, 50, 30);

        jComboBox_Pagamento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "nenhum", "Cheque", "Deposito", "Dinheiro" }));
        jComboBox_Pagamento.setEnabled(false);
        jComboBox_Pagamento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox_PagamentoActionPerformed(evt);
            }
        });
        getContentPane().add(jComboBox_Pagamento);
        jComboBox_Pagamento.setBounds(620, 110, 130, 30);

        jFormattedTextField_Conta.setEnabled(false);
        jFormattedTextField_Conta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jFormattedTextField_ContaActionPerformed(evt);
            }
        });
        getContentPane().add(jFormattedTextField_Conta);
        jFormattedTextField_Conta.setBounds(620, 150, 130, 30);

        jFormattedTextField_Agencia.setEnabled(false);
        getContentPane().add(jFormattedTextField_Agencia);
        jFormattedTextField_Agencia.setBounds(620, 190, 130, 30);

        jScrollPane1.setEnabled(false);

        jPanel_Area.setBackground(new java.awt.Color(255, 255, 255));
        jPanel_Area.setEnabled(false);
        jPanel_Area.setLayout(new java.awt.GridLayout(0, 3, 4, 7));

        jCheckBox1_EF2_FUNCIONARIO.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jCheckBox1_EF2_FUNCIONARIO.setText("EF2");
        jCheckBox1_EF2_FUNCIONARIO.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox1_EF2_FUNCIONARIOActionPerformed(evt);
            }
        });
        jPanel_Area.add(jCheckBox1_EF2_FUNCIONARIO);

        jCheckBox1_EFF1_FUNCIONARIO.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jCheckBox1_EFF1_FUNCIONARIO.setText("EF1");
        jPanel_Area.add(jCheckBox1_EFF1_FUNCIONARIO);

        jCheckBox1_EI_FUNCIONARIO.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jCheckBox1_EI_FUNCIONARIO.setText("EI");
        jCheckBox1_EI_FUNCIONARIO.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jCheckBox1_EI_FUNCIONARIO.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jCheckBox1_EI_FUNCIONARIO.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBox1_EI_FUNCIONARIOActionPerformed(evt);
            }
        });
        jPanel_Area.add(jCheckBox1_EI_FUNCIONARIO);

        jScrollPane1.setViewportView(jPanel_Area);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(70, 190, 270, 70);

        jComboBox_Cargo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "nenhum", "Assitente", "Coordenador", "Presidente", "Professor" }));
        jComboBox_Cargo.setEnabled(false);
        getContentPane().add(jComboBox_Cargo);
        jComboBox_Cargo.setBounds(390, 190, 140, 30);

        jLabel_Agencia.setText("Agência:");
        jLabel_Agencia.setEnabled(false);
        getContentPane().add(jLabel_Agencia);
        jLabel_Agencia.setBounds(550, 190, 60, 30);

        jLabel_Nome.setText("Nome:");
        jLabel_Nome.setEnabled(false);
        getContentPane().add(jLabel_Nome);
        jLabel_Nome.setBounds(20, 110, 40, 30);

        jLabel_Pagamento.setText("Pagamento:");
        jLabel_Pagamento.setEnabled(false);
        getContentPane().add(jLabel_Pagamento);
        jLabel_Pagamento.setBounds(550, 110, 70, 30);

        jLabel_IMG_bgCima.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/backgroudlado - CIMA.jpg"))); // NOI18N
        getContentPane().add(jLabel_IMG_bgCima);
        jLabel_IMG_bgCima.setBounds(0, 90, 760, 10);

        jLabel_IMG_bgLado2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/abamenu.jpg"))); // NOI18N
        getContentPane().add(jLabel_IMG_bgLado2);
        jLabel_IMG_bgLado2.setBounds(760, 90, 170, 190);

        jLabel_IMG_bgLado.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/abamenu.jpg"))); // NOI18N
        getContentPane().add(jLabel_IMG_bgLado);
        jLabel_IMG_bgLado.setBounds(0, 90, 10, 190);

        jLabel_IMG_bgBaixo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/backgroudlado - CIMA - Copia.jpg"))); // NOI18N
        getContentPane().add(jLabel_IMG_bgBaixo);
        jLabel_IMG_bgBaixo.setBounds(0, 270, 930, 10);

        jLabel_IMG_bg2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/registro.jpg"))); // NOI18N
        getContentPane().add(jLabel_IMG_bg2);
        jLabel_IMG_bg2.setBounds(0, 90, 920, 190);

        jLabelIMGbg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/evl/tecinfo/gui/imagens/backgroud.jpg"))); // NOI18N
        jLabelIMGbg.setText("jLabel2");
        getContentPane().add(jLabelIMGbg);
        jLabelIMGbg.setBounds(0, 0, 920, 570);

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSairActionPerformed
        clicou_ok = JOptionPane.showConfirmDialog(null, "Deseja cancelar o cadastramento da área?", "Confirmação", JOptionPane.YES_NO_OPTION);
        if (clicou_ok == JOptionPane.YES_OPTION) {
            this.dispose();

        } else if (clicou_ok == JOptionPane.NO_OPTION) {
        }
    }//GEN-LAST:event_jButtonSairActionPerformed

    private void jFormattedTextField_ContaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jFormattedTextField_ContaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jFormattedTextField_ContaActionPerformed

    private void jButtonEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEditarActionPerformed
        // TODO add your handling code here:
        jLabel_Nome.setEnabled(true);
        jLabel_CPF.setEnabled(true);
        JLabel_Cargo.setEnabled(true);
        jLabel_Hora.setEnabled(true);
        jLabel_Area.setEnabled(true);
        jLabel_Pagamento.setEnabled(true);
        jFormattedTextField_Nome.setEnabled(true);
        jFormattedTextField_CPF.setEnabled(true);
        jComboBox_Cargo.setEnabled(true);
        jFormattedTextField_Hora.setEnabled(true);
        jComboBox_Pagamento.setEnabled(true);
        jButtonSalvar.setEnabled(true);
        jButtonRemover.setEnabled(false);
        jButtonEditar.setEnabled(false);
        jPanel_Area.setEnabled(true);
        jScrollPane1.setEnabled(true);
        for (int i = 0; i < areasJCheckBox.size(); i++) {
            areasJCheckBox.get(i).setEnabled(true);
        }

    }//GEN-LAST:event_jButtonEditarActionPerformed

    private void jComboBox_PagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_PagamentoActionPerformed
        // TODO add your handling code here:
        // HABILITAR OS CAMPOS DE CONTA E AGENCIA SOMENTE QUNADO COMBOBOX FOR ALTERADO PARA "DEPOSITO"
        if (jComboBox_Pagamento.getSelectedIndex() == 2) {
            jFormattedTextField_Conta.setEnabled(true);
            jFormattedTextField_Agencia.setEnabled(true);
            jLabel_Conta.setEnabled(true);
            jLabel_Agencia.setEnabled(true);
        } else {
            jFormattedTextField_Conta.setEnabled(false);
            jFormattedTextField_Agencia.setEnabled(false);
            jLabel_Conta.setEnabled(false);
            jLabel_Agencia.setEnabled(false);
            jFormattedTextField_Agencia.setText("");
            jFormattedTextField_Conta.setText("");
        }
    }//GEN-LAST:event_jComboBox_PagamentoActionPerformed

    private void jCheckBox1_EF2_FUNCIONARIOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1_EF2_FUNCIONARIOActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCheckBox1_EF2_FUNCIONARIOActionPerformed

    private void jCheckBox1_EI_FUNCIONARIOActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1_EI_FUNCIONARIOActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jCheckBox1_EI_FUNCIONARIOActionPerformed

    private void jButtonSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSalvarActionPerformed
        boolean nomevazio = false;
        boolean cpfvazio = false;
        boolean cargovazio = false;
        boolean areavazio = false;
        boolean horavazio = false;
        boolean pagamentovazio = false;
        boolean contavazio = false;
        boolean agenciavazio = false;

        //CÓDIGO PARA CHECAR SE OS CAMPOS DO CADASTROS E ALTERAR COR DOS CAMPOS VAZIOS
        if (linha_editar == -1) {
            if (jFormattedTextField_Nome.getText().equals("")) {
                jFormattedTextField_Nome.setBackground(new Color(255, 209, 209));
                nomevazio = true;
            } else {
                jFormattedTextField_Nome.setBackground(new Color(255, 255, 255));
                nomevazio = false;
            }
            if (jFormattedTextField_CPF.getText().equals("   .   .   -  ")) {
                jFormattedTextField_CPF.setBackground(new Color(255, 209, 209));
                cpfvazio = true;
            } else {
                jFormattedTextField_CPF.setBackground(new Color(255, 255, 255));
                cpfvazio = false;
            }

            for (int i = 0; i < areasJCheckBox.size(); i++) {
                areasJCheckBox.get(i).isSelected();
                if (!areasJCheckBox.get(i).isSelected()) {
                    jPanel_Area.setBackground(new Color(255, 209, 209));
                    areavazio = true;
                } else {
                    jPanel_Area.setBackground(new Color(255, 255, 255));
                    areavazio = false;
                    break;
                }
            }

            if (jComboBox_Cargo.getSelectedIndex() == 0) {
                jComboBox_Cargo.setBackground(new Color(255, 209, 209));
                cargovazio = true;
            } else {
                jComboBox_Cargo.setBackground(new Color(255, 255, 255));
                cargovazio = false;
            }


            if (jFormattedTextField_Hora.getText().equals("  ,  ")) {
                jFormattedTextField_Hora.setBackground(new Color(255, 209, 209));
                horavazio = true;
            } else {
                jFormattedTextField_Hora.setBackground(new Color(255, 255, 255));
                horavazio = false;
            }
            if (jComboBox_Pagamento.getSelectedIndex() == 0) {
                jComboBox_Pagamento.setBackground(new Color(255, 209, 209));
                pagamentovazio = true;
            } else if (jComboBox_Pagamento.getSelectedIndex() == 2) {
                jFormattedTextField_Conta.setEnabled(true);
                if (jFormattedTextField_Conta.getText().equals("")) {
                    jFormattedTextField_Conta.setBackground(new Color(255, 209, 209));
                    contavazio = true;
                } else {
                    jFormattedTextField_Conta.setBackground(new Color(255, 255, 255));
                    contavazio = false;
                }
                jFormattedTextField_Agencia.setEnabled(true);
                if (jFormattedTextField_Agencia.getText().equals("")) {
                    jFormattedTextField_Agencia.setBackground(new Color(255, 209, 209));
                    contavazio = true;
                } else {
                    jFormattedTextField_Agencia.setBackground(new Color(255, 255, 255));
                    contavazio = false;
                }
            } else {
                jComboBox_Pagamento.setBackground(new Color(255, 255, 255));
                pagamentovazio = false;
            }
            //CHECANDO SE HÁ CAMPOS VAZIOS
            if (nomevazio == true || cpfvazio == true || cargovazio == true || areavazio == true || horavazio == true
                    || pagamentovazio == true || contavazio == true || agenciavazio == true) {
                java.awt.Toolkit.getDefaultToolkit().beep();
                JOptionPane.showMessageDialog(null, "Por favor preencha os campos vazios.");
                //CONFIMANDO SE TODOS CAMPOS ESTÃO PREENCHIDOS     
            } else if (nomevazio == false && cpfvazio == false && cargovazio == false && areavazio == false && horavazio == false
                    && pagamentovazio == false && contavazio == false && agenciavazio == false) {



                new EditarFuncionario().setVisible(true);
                this.dispose();


            }
        }
    }//GEN-LAST:event_jButtonSalvarActionPerformed

    private void jButtonRemoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRemoverActionPerformed
        if (jTableEditFuncionario.getSelectedRowCount() != 0) {
            clicou_ok = JOptionPane.showConfirmDialog(null, "Tem certeza que deseja deletar esse Funcionário?", "Confirmação", JOptionPane.YES_NO_OPTION);
            if (clicou_ok == JOptionPane.YES_OPTION) {
            } else if (clicou_ok == JOptionPane.NO_OPTION) {
            }
        } else {
            java.awt.Toolkit.getDefaultToolkit().beep();
            JOptionPane.showMessageDialog(null, "Por favor selecione uma linha da tabela");
        }
    }//GEN-LAST:event_jButtonRemoverActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(EditarFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(EditarFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(EditarFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(EditarFuncionario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new EditarFuncionario().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel JLabel_Cargo;
    private javax.swing.JButton jButtonEditar;
    private javax.swing.JButton jButtonRemover;
    private javax.swing.JButton jButtonSair;
    private javax.swing.JButton jButtonSalvar;
    private javax.swing.JCheckBox jCheckBox1_EF2_FUNCIONARIO;
    private javax.swing.JCheckBox jCheckBox1_EFF1_FUNCIONARIO;
    private javax.swing.JCheckBox jCheckBox1_EI_FUNCIONARIO;
    private javax.swing.JComboBox jComboBox_Cargo;
    private javax.swing.JComboBox jComboBox_Pagamento;
    private javax.swing.JFormattedTextField jFormattedTextField_Agencia;
    private javax.swing.JFormattedTextField jFormattedTextField_CPF;
    private javax.swing.JFormattedTextField jFormattedTextField_Conta;
    private javax.swing.JFormattedTextField jFormattedTextField_Hora;
    private javax.swing.JFormattedTextField jFormattedTextField_Nome;
    private javax.swing.JLabel jLabelIMGListaFuncionario;
    private javax.swing.JLabel jLabelIMGbg;
    private javax.swing.JLabel jLabelTitulo;
    private javax.swing.JLabel jLabel_Agencia;
    private javax.swing.JLabel jLabel_Area;
    private javax.swing.JLabel jLabel_CPF;
    private javax.swing.JLabel jLabel_Conta;
    private javax.swing.JLabel jLabel_Hora;
    private javax.swing.JLabel jLabel_IMG_bg2;
    private javax.swing.JLabel jLabel_IMG_bgBaixo;
    private javax.swing.JLabel jLabel_IMG_bgCima;
    private javax.swing.JLabel jLabel_IMG_bgLado;
    private javax.swing.JLabel jLabel_IMG_bgLado2;
    private javax.swing.JLabel jLabel_Nome;
    private javax.swing.JLabel jLabel_Pagamento;
    private javax.swing.JPanel jPanel_Area;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTableEditFuncionario;
    // End of variables declaration//GEN-END:variables
}
